package com.itheima.service.impl;

import com.itheima.dao.GoodsDao;
import com.itheima.dao.impl.GoodsDaoImpl;
import com.itheima.domain.Goods;
import com.itheima.service.GoodsService;
import com.itheima.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class GoodsServiceImpl implements GoodsService {

    //TODO:setter方式注入GoodsDao

    public GoodsDao getGoodsDao() {
        return goodsDao;
    }

    public void setGoodsDao(GoodsDao goodsDao) {
        this.goodsDao = goodsDao;
    }

    private GoodsDao goodsDao;

    @Override
    public List<Goods> findList() {
        //TODO:调用GoodsDao的查询列表方法

/*        ApplicationContext ctx
                = new ClassPathXmlApplicationContext("applicationContext.xml");
        GoodsService service = (GoodsService) ctx.getBean("GoodsService");
        service.findList();*/
        return goodsDao.queryList();
    }

}
